The PIOFAKE Sample accompanies Chapter 9 and illustrates how to use a watchdog timer.
The sample includes two components:
To build PIOFAKE.SYS, follow the general instructions for building a WDM sample. The Microsoft Visual C++ project file is named PIOFAKE.DSP in the SYS subdirectory.
To build TEST.EXE, follow the general instructions for building user-mode programs. The Microsoft Visual C++ project file is named TEST.DSP in the TEST subdirectory.
Install the PIOFAKE "device." Follow the general instructions for using FastInst in Windows 2000 or the Add New Hardware wizard in Windows 98. The INF file is named SYS\DEVICE.INF. In Windows 98 only, take note of the IRQ and port address that the PnP Manager assigns.
If you're running in Windows 2000, launch the TEST.EXE program from the TEST\DEBUG subdirectory. Wait about 10 seconds. The write operation that TEST performs will time out, and TEST will report an error.
If you're running in Windows 98, you can launch the DEVTEST.EXE program that you'll find in the directory where you installed the book samples (e.g., WDMBOOK). Fill in the port address and IRQ, and then press the Initialize button:
Now open a command prompt and launch TEST.EXE from the TEST\DEBUG subdirectory. The letter "H" should appear in the Device Data control of the DEVTEST dialog. If you press the Interrupt button before 10 seconds elapse, you'll see the second character of the output string TEST is trying to write. You can continue pressing the Interrupt button to see the rest of the message, but you'll be able to guess the contents long before it finishes printing. Delay more than 10 seconds to see the write operation time out.